<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        
        button {
            display: block;
            margin: 20px auto;
            height: 50px;
            width: 80px;
        }
        
        #header {
            width: 700px;
            height: 200px;
            margin: 0 auto;
            display: flex;
        }
        
        .lxx {
            width: 200px;
            height: 200px;
            background-color: red;
            margin-left: 25px;
        }
    </style>
    </style>
</head>

<body>
    <button>点击一下</button>
    <nav id="header">
        <div class="lxx"></div>
        <div class="lxx"></div>
        <div class="lxx"></div>
    </nav>
    <script>
        var a = 234;
        for (var j = 2; j < a; j++) {
            if (a % j == 0) {
                console.log(a + '不是质数');
                break;
            }
            if (j = a - 1) {
                console.log(a + '是质数');
            }
        }



        function sum(a) {

            for (var j = 2; j < a; j++) {
                if (a % j == 0) {
                    console.log(a + '不是质数');
                    break;
                }
                if (j = a - 1) {
                    console.log(a + '是质数');
                }
            }
        }
        sum(55);

        function multi(a, b) {
            var result = a * b;

            return result;
        }
        var value = multi(99, 88);

        console.log(value);
        var values = multi(11, 11);
        console.log(values)

        var stu = {
            name: 'lx',
            age: 18,
            major: 'H5',
            study: function () {
                console.log('hao hao xue xi,tian tian xiang shang');
                console.log('你好，我叫' + this.name);
            }
        }
        stu.study();

       function year(a){
           if(a % 4 == 0&&a % 100 != 0 || a % 400 == 0){
               console.log(a + '是闰年');
           }else{
               console.log(a + '不是闰年');
           }

       }

       year(1889);




       
        var sum =0;
        var btn = document.querySelector('button');
        var lxx = document.getElementsByClassName('lxx');
        btn.onclick = function () {
            sum ++;
            for (var i = 0; i < lxx.length; i++) {
                lxx[i].style.backgroundColor = sum%2==0?'green':'blue';
                }

        }
   
    </script>
</body>

</html>